<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>label table</title>
    <link href="static/bootstrap.min.css" rel="stylesheet">
    <script src="static/jquery.min.js"></script>
    <script src="static/bootstrap.min.js"></script>
    <link href="static/bootstrap-slider.min.css" rel="stylesheet">
    <script src="static/jquery.mousewheel.min.js"></script>
    <script type='text/javascript' src="static/bootstrap-slider.min.js"></script>
    <style>
        td {
            text-align: center;
        }

        caption {
            text-align: center;
            text-transform: uppercase;
        }
    </style>
</head>


<body>

    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <table class="table table-bordered">
                    <caption>
                        <h1>Work Space for {{ username }} </h1>
                    </caption>
                    <tbody>
                        {% for row in cdata %}
                        <tr>
                            {% for d in row  %}
                            {% ifequal d.tag 1 %}
                            <td class="btn-success">{{ d.data }}</td>
                            {% endifequal %}
                            {% ifequal d.tag -1 %}
                            <td class="btn-warning">{{ d.data }}</td>
                            {% endifequal %}
                            {% ifequal d.tag 0 %}
                            <td class="btn-default">{{ d.data }}</td>
                            {% endifequal %}
                            {% endfor %}
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <script>
        $('td').click(function () {
            var form = '<form action="/label" method="POST">' +
                '<input type="hidden" name="user" value="{{ username }}">' +
                '<input type="hidden" name="imgid" value="' + this.innerHTML + '">' +
                '</form>';
            $(document.body).append(form);
            $('form').submit();
        });
    </script>

</html>